#include "..\include\ManaBottle.hpp"


ManaBottle::ManaBottle(SpritesManager* _spritesManager, int posXInit, int posYInit)
{
	spritesManager = _spritesManager;
	initialize(posXInit, posYInit);
}


ManaBottle::~ManaBottle(void)
{
}

void ManaBottle::initialize(int posXInit, int posYInit){

	x = posXInit;
	if (posYInit > 192){
		y = (192*2) - posYInit;
		screen = TOP;
	}
	else {
		y = 192 - posYInit;
		screen = BOTTOM;
	}

	if (x >= -32 && x < 300){
		displayed = true;
		displayManaBottle();
	}
	else {
		displayed = false;
	}
}

void ManaBottle::displayManaBottle(){
	Sprite* image1 = new Sprite();
	if (screen == BOTTOM){
		image1->display(spritesManager, screen, x, y, OBJPRIORITY_3, spritesManager->MANA, spritesManager->MANA_PAL, MANA_BOTTLE);
	}
	else {
		image1->display(spritesManager, screen, x, y, OBJPRIORITY_3, spritesManager->MANA_TOP, spritesManager->MANA_PAL_TOP, MANA_BOTTLE);
	}
	OAM_ID = image1->OAM_ID;
}
